package com.neusoft.nepa.controller;

import com.neusoft.nepa.UserLogin;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;

import java.io.IOException;

public class VukenAdminLoginViewController {


    @FXML private Button OperatorSwap;
    @FXML private Button AdminSwap;
    @FXML private TextField LoginName;
    @FXML private PasswordField LoginPassword;

    private UserLogin mainApp;

    public void setMainApp(UserLogin mainApp) {
        this.mainApp = mainApp;
    }
    @FXML
    private void handleLogin() throws IOException {
        if (LoginName.getText().trim().isEmpty() || LoginPassword.getText().trim().isEmpty()) {
            mainApp.FormNotCorrect();
        }
        else {
            mainApp.loginDetect(LoginName.getText().trim(), LoginPassword.getText().trim());
        }
    }
    @FXML
    private void handleRegister() throws IOException {
        mainApp.showRegisterView();
        //mainApp.showColorMap();
        //mainApp.showAdminView();
    }
    @FXML
    private void handleOperator() throws IOException {
        mainApp.showColorMap();
    }
    @FXML
    private void handleAdmin() throws IOException {
        mainApp.showAdminView();
    }
}